//
//  THJFabuManageCell.m
//  THJXHW
//
//  Created by 河南德艺 on 17/3/30.
//  Copyright © 2017年 河南德艺. All rights reserved.
//

#import "THJFabuManageCell.h"

@implementation THJFabuManageCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
}
-(void)updateCellContentWithDic:(NSDictionary*)dic Type:(NSInteger)type{
    self.titleLab.text = dic[@"title"];
    NSInteger status = [dic[@"status"] integerValue];
    NSString * statusStr;
    switch (status) {
        case 1:
            statusStr = @"未通过";
            break;
        case 2:
            statusStr = @"未审核";
            break;
        case 3:
            statusStr = @"已发布";
            break;
        case 4:
            statusStr = @"已下架";
            break;
        default:
            break;
    }
    self.statusLab.text = statusStr;
    NSString * gg = [THJTools guigeTypeChangeToStrWithType:dic[@"gg"]];
    self.label1.text = [NSString stringWithFormat:@"规格:%@",gg];
    self.label4.text = [NSString stringWithFormat:@"产地:%@",dic[@"jhd"]];
    self.label5.text = [NSString stringWithFormat:@"日期:%@",dic[@"addtime"]];
    if ([dic[@"price"] isEqual:@"0"]) {
         self.priceLab.text = @"价格面议";
    }else{
         self.priceLab.text = [NSString stringWithFormat:@"￥%@/吨",dic[@"price"]];
    }
   
    
    if(type == 0){
        //重量或库存
        self.label2.text = [NSString stringWithFormat:@"库存:%@",dic[@"amount"]];
        //销量或分类
        self.label3.text = [NSString stringWithFormat:@"销量:%@",dic[@"sales"]];
    }else{
        if(type == 3){
            self.label2.text = [NSString stringWithFormat:@"采购数量:%@",dic[@"cainum"]];
        }else{
            self.label2.text = [NSString stringWithFormat:@"重量:%@",dic[@"zl"]];
        }
        self.label3.text = [NSString stringWithFormat:@"分类:%@",dic[@"business"]];

    }
    if (type == 2 || type == 3) {
        self.priceLab.text = @"";
    }
}
@end
